import pymysql
conn=None
cs =None
try:
    conn=pymysql.connect(host="211.103.136.244", port=7061,
    user="student", password="iHRM_student_2021",
    database="test_db", charset="utf8")
    cs=conn.cursor()
    res=cs.execute("delete from t_book where title='捉妖记';")
    print("影响的行数",res)
    conn.commit()

except Exception as e:
    print("只打印错误结果",e)
    conn.rollback()
finally:
    cs.close()
    conn.close()







